home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Skeleton / Source / App.cpp next >
Text File  |  1997-02-06  |  3KB  |  142 lines

  1. /*
  2.  *  File:       App.cpp
  3.  *  Summary:       Application object.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. All Rights Reserved.
  7.  *
  8.  *  Change History (most recent first):    
  9.  *
  10.  *         <->     5/25/96    JDJ        Created
  11.  */
  12.  
  13. #include "App.h"
  14.  
  15. #include <ZDialogUtils.h>
  16. #include <ZWindowMenuMgr.h>
  17.  
  18. #include "Doc.h"
  19.  
  20.  
  21. // ===================================================================================
  22. //    class CApplication
  23. // ===================================================================================
  24.  
  25. //---------------------------------------------------------------
  26. //
  27. // CApplication::~CApplication
  28. //
  29. //---------------------------------------------------------------
  30. CApplication::~CApplication()
  31. {
  32.     PRECONDITION(true);
  33. }
  34.  
  35.  
  36. //---------------------------------------------------------------
  37. //
  38. // CApplication::CApplication
  39. //
  40. //---------------------------------------------------------------
  41. CApplication::CApplication()
  42. {
  43.     // ・・・ハThese two data members belong to TDocApplication. You
  44.     // ・・・ハneed to change them to your document's type so that
  45.     // ・・・ハTDocApplication can open the correct files.
  46.     mNumFileTypes = 1;
  47.     mFileTypes[0] = 'DATA';
  48.  
  49. //    POSTCONDITION(true);            // wait till HandleInit is called (by Run)            
  50. }
  51.  
  52. #pragma mark ハ
  53.  
  54. //---------------------------------------------------------------
  55. //
  56. // CApplication::OnInit
  57. //
  58. //---------------------------------------------------------------
  59. void CApplication::OnInit()
  60. {
  61.     Inherited::OnInit();
  62.  
  63.     TWindowMenuMgr::Init();
  64. }
  65.  
  66.  
  67. //---------------------------------------------------------------
  68. //
  69. // CApplication::OnQuit
  70. //
  71. //---------------------------------------------------------------
  72. void CApplication::OnQuit()
  73. {
  74.     TWindowMenuMgr::Terminate();
  75.     
  76.     Inherited::OnQuit();
  77. }
  78.  
  79.  
  80. //---------------------------------------------------------------
  81. //
  82. // CApplication::OnAboutBox
  83. //
  84. //---------------------------------------------------------------
  85. void CApplication::OnAboutBox()
  86. {
  87.     (void) DoAlert(256);
  88. }
  89.  
  90.  
  91. //---------------------------------------------------------------
  92. //
  93. // CApplication::OnCreateDoc
  94. //
  95. //---------------------------------------------------------------
  96. TDocument* CApplication::OnCreateDoc()
  97. {
  98.     CDocument* doc = new CDocument(this);
  99.     
  100.     // Documents are reference counted and are created with their
  101.     // ref count being zero. TDocWindow dtor decrements its document's
  102.     // reference count. If there are no other references to the
  103.     // document the document is deleted.
  104.     (void) TWindow::Create(256, doc);
  105.     
  106.     return doc;
  107. }
  108.  
  109.  
  110. //---------------------------------------------------------------
  111. //
  112. // CApplication::OnMenuCommand
  113. //
  114. //---------------------------------------------------------------
  115. bool CApplication::OnMenuCommand(const MenuCommand& command)
  116. {
  117.     bool handled = false;
  118.     
  119.     if (mQuitting || !TWindowMenuMgr::Instance()->HandleMenuCommand(command))
  120.         handled = Inherited::OnMenuCommand(command);
  121.     
  122.     return handled;
  123. }
  124.  
  125.     
  126. //---------------------------------------------------------------
  127. //
  128. // CApplication::OnCommandStatus
  129. //
  130. //---------------------------------------------------------------
  131. bool CApplication::OnCommandStatus(const MenuCommand& command, SCommandStatus& status)
  132. {
  133.     bool handled = false;
  134.     
  135.     if (mQuitting || !TWindowMenuMgr::Instance()->HandleCommandStatus(command, status))
  136.         handled = Inherited::OnCommandStatus(command, status);
  137.     
  138.     return handled;
  139. }
  140.  
  141.  
  142.